package de.hatraco.funderberg.blackjack.views;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JLayeredPane;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.SwingConstants;

import de.hatraco.funderberg.blackjack.data.DataMISC;
import de.hatraco.funderberg.blackjack.data.GraphicsBlackJack;
import de.hatraco.funderberg.blackjack.utils.TimeBlackJack;

public class MainView extends JFrame {
	
	//Singleton Pattern: Stellt sicher, dass nur ein InstanceWindow von MainView existiert
	private static MainView frame = new MainView();
		
		public static MainView getInstanceWindow() {
			if (frame == null) {
				frame = new MainView();
			}
			return frame;
		}
	
	private JLayeredPane content;	
		
	private JLabel background;
	private JLabel card_b1;
	private JLabel card_b2;
	private JLabel card_b3;
	private JLabel card_b4;
	private JLabel card_b;
	private JLabel dealername;
	private JLabel dealervalue;	
	//private JLabel dealerwins;
	//private JLabel youwin;
	private JLabel time;
	
	private JMenuBar bar;
	private JMenu menu;
	
	//Ships
	private JLabel ship_dealer1;
	private JLabel ship_dealer2;
	private JLabel ship_dealer3;
	private JLabel ship_dealer4;
	private JLabel ship_dealer5;
	private JLabel ship_dealer6;
	private JLabel ship_dealer7;
	private JLabel ship_dealer8;
	private JLabel ship_dealer9;
	private JLabel ship_p1_1;
	private JLabel ship_p1_2;
	private JLabel ship_p1_3;
	private JLabel ship_p1_4;
	private JLabel ship_p1_5;
	private JLabel ship_p1_6;
	private JLabel ship_p1_7;
	private JLabel ship_p1_8;
	private JLabel ship_p1_9;
	private JLabel ship_p2_1;
	private JLabel ship_p2_2;
	private JLabel ship_p2_3;
	private JLabel ship_p2_4;
	private JLabel ship_p2_5;
	private JLabel ship_p2_6;
	private JLabel ship_p2_7;
	private JLabel ship_p2_8;
	private JLabel ship_p2_9;
	private JLabel ship_p3_1;
	private JLabel ship_p3_2;
	private JLabel ship_p3_3;
	private JLabel ship_p3_4;
	private JLabel ship_p3_5;
	private JLabel ship_p3_6;
	private JLabel ship_p3_7;
	private JLabel ship_p3_8;
	private JLabel ship_p3_9;
	private JLabel ship_p4_1;
	private JLabel ship_p4_2;
	private JLabel ship_p4_3;
	private JLabel ship_p4_4;
	private JLabel ship_p4_5;
	private JLabel ship_p4_6;
	private JLabel ship_p4_7;
	private JLabel ship_p4_8;
	private JLabel ship_p4_9;
	
	//Heads
	private JLabel head_1;
	private JLabel head_2;
	private JLabel head_3;
	private JLabel head_4;
	private JLabel head_5;
	private JLabel head_6;
	private JLabel head_7;
	private JLabel head_8;
	private JLabel head_9;
	private JLabel head_10;
	private JLabel head_11;
	private JLabel head_12;
	private JLabel head_13;
	private JLabel head_14;
	private JLabel head_15;
	private JLabel head_16;
		
	//Buttons
	private JButton button_newcard;
	private JButton button_double;
	private JButton button_bet;
	private JButton button_stand;
	private JButton button_split;
	private JButton button_deal;
	private JButton button_help;
	private JButton button_options;
	
	
	//Lists
	//private List<JLabel> jplayer = new ArrayList<JLabel>();
	//private List<JLabel> jplayer2 = new ArrayList<JLabel>();
	//private List<JLabel> jstackint = new ArrayList<JLabel>();
	private List<JLabel> cardsimg = new ArrayList<JLabel>();
	private List<JLabel> ships_dealer = new ArrayList<JLabel>();
	private List<JLabel> ships_p1 = new ArrayList<JLabel>();
	private List<JLabel> ships_p2 = new ArrayList<JLabel>();
	private List<JLabel> ships_p3 = new ArrayList<JLabel>();
	private List<JLabel> ships_p4 = new ArrayList<JLabel>();
	private List<List<JLabel>> ships_players = new ArrayList<List<JLabel>>();
	private List<JLabel> heads = new ArrayList<JLabel>();
	private List<JButton> jbuttons = new ArrayList<JButton>();
	private List<PlayerView> players = new ArrayList<PlayerView>();
	
	private PlayerView p1;
	private PlayerView p2;
	private PlayerView p3;
	private PlayerView p4;
	
	private int x = 0;
	private int y = 0;
	
	//private String link = DataMISC.LINKIMG;
	//private String cardlink = DataMISC.LINKCARDS;
	
	private GraphicsBlackJack img;
	private TimeBlackJack tbj;
	
	public MainView() {
		
		//Instanziert GraphicsBlackJack (für die Bilder)
		this.img = GraphicsBlackJack.getInstance();
		//Instanziert TimeBlackJack (für die Anzeige der Uhrzeit)
		this.tbj = TimeBlackJack.getInstance();
		
		//Gibt dem Fenster ein "leeres" Layout
		this.getContentPane().setLayout(null);
		
		//Legt fest, was bei Aktionen mit dem Fenster passiert: Lediglich "Close" hat eine Auswirkung
		this.addWindowListener(new WindowListener() {
			//Invoked when a window has been closed as the result of calling dispose on the window
			public void windowClosed(WindowEvent arg0) {}
			//Invoked when the Window is set to be the active Window
			public void windowActivated(WindowEvent e) {}
			//Invoked when the user attempts to close the window from the window's system menu -> Programm wird beendet
			public void windowClosing(WindowEvent e) {
				System.exit(0);
			}
			//Invoked when a Window is no longer the active Window
			public void windowDeactivated(WindowEvent e) {}
			//Invoked when a window is changed from a minimized to a normal state
			public void windowDeiconified(WindowEvent e) {}
			//Invoked when a window is changed from a normal to a minimized state
			public void windowIconified(WindowEvent e) {}
			//Invoked the first time a window is made visible
			public void windowOpened(WindowEvent e) {}
		});
		
		//Setzt die Position und Größe des Fensters
		this.setBounds(470, 80, (int) Math.round(1146 * img.getResizefactor()), (int) Math.round((860 * img.getResizefactor() + 25)));
		//Legt fest, dass die Größe nicht verändert werden kann
		this.setResizable(false);
		//Legt fest, dass das Fenster über das "X" rechts oben geschlossen werden kann
		this.setDefaultCloseOperation(EXIT_ON_CLOSE);
		//Gibt dem Fenster ein BorderLayout
		this.setLayout(new BorderLayout());
		
		//Instanziert eine Leinwand "content"
		content = new JLayeredPane();
		//Fügt "content" dem Fenster hinzu
		this.add(content);
		//Legt den Hintergrund fest
		background = new JLabel(img.getBgdef());
		//Positioniert den Hintergrund
		background.setBounds(0, 0, this.getWidth(), this.getHeight()-25);
		//Fügt den Hintergrund der Leinwand hinzu
		content.add(background);
		
		bar = new JMenuBar();
		menu = new JMenu("Options");
		bar.add(menu);
		this.setJMenuBar(bar);
		
		//TODO am Ende löschen
		System.out.println(img.getDimX());
		System.out.println(img.getDimY());
		System.out.println(img.getDim());
		System.out.println(this.getWidth());
		System.out.println(this.getHeight());
		System.out.println(img.getResizefactor());
		
		//Instanziert, modifiziert und positioniert Elemente und fügt diese der Elinwand hinzu
		
		//Label mit der Uhrzeit
		time = new JLabel(tbj.getTime());
		time.setBounds(
				(int) Math.round(this.getWidth() - (100 * img.getResizefactor())), 
				(int) Math.round(15 * img.getResizefactor()), 
				(int) Math.round(80 * img.getResizefactor()), 
				(int) Math.round(30 * img.getResizefactor())
		);
		time.setHorizontalAlignment(SwingConstants.CENTER);
		time.setFont(DataMISC.ARIAL_BOLD20.deriveFont((float)(20 * img.getResizefactor())));
		time.setForeground(Color.WHITE);
		time.setBorder(DataMISC.BORDER_W);
		content.add(time);
		time.setVisible(true);
		
		//Elemente des Dealers
		dealername = new JLabel();
		dealername.setText("Dealer");
		dealername.setBounds(
				(int) Math.round((this.getWidth() / 2) - (50 * img.getResizefactor())), 
				(int) Math.round(10 * img.getResizefactor()), 
				(int) Math.round(100 * img.getResizefactor()), 
				(int) Math.round(30 * img.getResizefactor())
		);
		dealername.setHorizontalAlignment(SwingConstants.CENTER);
		dealername.setFont(DataMISC.ARIAL_BOLD20.deriveFont((float)(20 * img.getResizefactor())));
		dealername.setOpaque(true);
		dealername.setBackground(DataMISC.BROWN_FONTS);
		dealername.setForeground(Color.WHITE);
		dealername.setBorder(DataMISC.BORDER_W);
		content.add(dealername);
		dealername.setVisible(true);
		
		dealervalue = new JLabel();
		dealervalue.setBounds(
				(dealername.getX() - (int) Math.round(52 * img.getResizefactor())), 
				(dealername.getY() + (int) Math.round(275 * img.getResizefactor())), 
				(int) Math.round(60 * img.getResizefactor()), 
				(int) Math.round(20 * img.getResizefactor())
		);
		dealervalue.setHorizontalAlignment(SwingConstants.CENTER);
		dealervalue.setFont(DataMISC.ARIAL_BOLD16.deriveFont((float)(16 * img.getResizefactor())));
		dealervalue.setForeground(Color.WHITE);
		content.add(dealervalue);
		dealervalue.setVisible(false);
        
        //Kartenstapel
		card_b = new JLabel(img.getCback());
        card_b1 = new JLabel(img.getCback());
        card_b2 = new JLabel(img.getCback());
        card_b3 = new JLabel(img.getCback());
       	card_b4 = new JLabel(img.getCback());
       	
		card_b.setBounds((int) Math.round(dealername.getX() + dealername.getWidth() + (50 * img.getResizefactor())), 
				(int) Math.round(65 * img.getResizefactor()), 
				img.getCback().getIconWidth(),
				img.getCback().getIconHeight()
		);
       	card_b1.setBounds((card_b.getX() - 2), (card_b.getY() - 2), img.getCback().getIconWidth(),img.getCback().getIconHeight());
       	card_b2.setBounds((card_b1.getX() - 2), (card_b1.getY() - 2), img.getCback().getIconWidth(),img.getCback().getIconHeight());
       	card_b3.setBounds((card_b2.getX() - 2), (card_b2.getY() - 2), img.getCback().getIconWidth(),img.getCback().getIconHeight());
		card_b4.setBounds((card_b3.getX() - 2), (card_b3.getY() - 2), img.getCback().getIconWidth(),img.getCback().getIconHeight());
		
		content.add(card_b);
		content.add(card_b1);
		content.add(card_b2);
		content.add(card_b3);
		content.add(card_b4);
				
		//Spielkarten
		for (int a = 0; a <=5; a++) {
			for (int i = 0; i < 52; i++) {
				JLabel jl = new JLabel(img.getCards().get(i));
				cardsimg.add(jl);
			}
		}	
		for (int i = 0; i < cardsimg.size(); i++) {
			content.add(cardsimg.get(i));
			cardsimg.get(i).setVisible(false);
		}
        
		//Buttons
        button_newcard = new JButton(img.getBtnewcard());
		button_double = new JButton(img.getBtdouble());
		button_bet = new JButton(img.getBtbet());
		button_stand = new JButton(img.getBtstand());
		button_split = new JButton(img.getBtsplit());
		button_deal = new JButton(img.getBtdeal());
		button_help = new JButton(img.getBthelp());
		button_options = new JButton(img.getBtoptions());
		
		button_newcard.setBounds(
				(int) Math.round(86 * img.getResizefactor()),(int) Math.round(715 * img.getResizefactor()), 
				img.getBtnewcard().getIconWidth(),img.getBtnewcard().getIconHeight()
		);
		button_stand.setBounds((int) Math.round(86 * img.getResizefactor()),(int) Math.round(785 * img.getResizefactor()),
				img.getBtstand().getIconWidth(),img.getBtstand().getIconHeight()
		);
		button_double.setBounds((int) Math.round(226 * img.getResizefactor()),(int) Math.round(715 * img.getResizefactor()),
				img.getBtdouble().getIconWidth(),img.getBtdouble().getIconHeight()
		);
		button_split.setBounds((int) Math.round(226 * img.getResizefactor()),(int) Math.round(785 * img.getResizefactor()),
				img.getBtsplit().getIconWidth(),img.getBtsplit().getIconHeight()
		);
		button_bet.setBounds((int) Math.round(366 * img.getResizefactor()),(int) Math.round(715 * img.getResizefactor()),
				img.getBtbet().getIconWidth(),img.getBtbet().getIconHeight()
		);
		button_deal.setBounds((int) Math.round(366 * img.getResizefactor()),(int) Math.round(785 * img.getResizefactor()),
				img.getBtdeal().getIconWidth(),img.getBtdeal().getIconHeight()
		);
		button_help.setBounds((int) Math.round(15 * img.getResizefactor()), (int) Math.round(15 * img.getResizefactor()), 
				img.getBthelp().getIconWidth(),img.getBthelp().getIconHeight()
		);
		button_options.setBounds((int) Math.round(15 * img.getResizefactor()), (int) Math.round(15 * img.getResizefactor()), 
				img.getBtoptions().getIconWidth(),img.getBtoptions().getIconHeight()
		);
		
		jbuttons.add(button_newcard);
		jbuttons.add(button_double);
		jbuttons.add(button_bet);
		jbuttons.add(button_stand);
		jbuttons.add(button_split);
		jbuttons.add(button_deal);
		jbuttons.add(button_help);
		jbuttons.add(button_options);
		
		content.add(button_newcard);
		content.add(button_stand);
		content.add(button_double);
		content.add(button_split);
		content.add(button_bet);
		content.add(button_deal);
		//content.add(button_help);
		content.add(button_options);
		
		//Heads
		head_1 = new JLabel(img.getHead1());
		head_2 = new JLabel(img.getHead2());
		head_3 = new JLabel(img.getHead3());
		head_4 = new JLabel(img.getHead4());
		head_5 = new JLabel(img.getHead5());
		head_6 = new JLabel(img.getHead6());
		head_7 = new JLabel(img.getHead7());
		head_8 = new JLabel(img.getHead8());
		head_9 = new JLabel(img.getHead9());
		head_10 = new JLabel(img.getHead10());
		head_11 = new JLabel(img.getHead11());
		head_12 = new JLabel(img.getHead12());
		head_13 = new JLabel(img.getHead13());
		head_14 = new JLabel(img.getHead14());
		head_15 = new JLabel(img.getHead15());
		head_16 = new JLabel(img.getHead16());
		
		heads.add(head_1);
		heads.add(head_2);
		heads.add(head_3);
		heads.add(head_4);
		heads.add(head_5);
		heads.add(head_6);
		heads.add(head_7);
		heads.add(head_8);
		heads.add(head_9);
		heads.add(head_10);
		heads.add(head_11);
		heads.add(head_12);
		heads.add(head_13);
		heads.add(head_14);
		heads.add(head_15);
		heads.add(head_16);
		
		Collections.shuffle(heads);
		
		//Elemente der Spieler
		p1 = new PlayerView();
		p2 = new PlayerView();
		p3 = new PlayerView();
		p4 = new PlayerView();
		
		players.add(p1);
		players.add(p2);
		players.add(p3);
		players.add(p4);
		
		//Legt Positionswerte in Abhängigkeit der "Nummer" des Spielers fest
		for (int i = 0; i < 4; i++) {
			switch (i){
			case 0: x = (int) Math.round(this.getWidth() * 0.1); y = (int) Math.round(this.getHeight() * 0.074);
					break;
			case 1: x = (int) Math.round(this.getWidth() * 0.785); y = (int) Math.round(this.getHeight() * 0.074);
					break;
			case 2: x = (int) Math.round(this.getWidth() * 0.1); y = (int) Math.round(this.getHeight() * 0.42);
					break;
			case 3: x = (int) Math.round(this.getWidth() * 0.785); y = (int) Math.round(this.getHeight() * 0.42);
					break;
			default: x = 0; y = 0;
			}
			
			players.get(i).getName().setBounds(x, y, (int) Math.round(110 * img.getResizefactor()), (int) Math.round(30 * img.getResizefactor()));
			players.get(i).getName().setHorizontalAlignment(SwingConstants.CENTER);
			players.get(i).getName().setFont(DataMISC.ARIAL_BOLD20.deriveFont((float)(20 * img.getResizefactor())));
			players.get(i).getName().setOpaque(true);
			players.get(i).getName().setBackground(DataMISC.BROWN_FONTS);
			players.get(i).getName().setForeground(Color.WHITE);
			players.get(i).getName().setBorder(DataMISC.BORDER_W);
			
			players.get(i).setHead(heads.get(i));
			players.get(i).getHead().setBounds(
					(x - (int) Math.round(12 * img.getResizefactor())), 
					(y + (int) Math.round(30 * img.getResizefactor())), 
					(int) Math.round(131 * img.getResizefactor()), 
					(int) Math.round(141 * img.getResizefactor())
			);
			players.get(i).getHead().setOpaque(false);
						
			players.get(i).getName2().setBounds(
					(int) Math.round((this.getWidth() / 2) + (80 * img.getResizefactor())), 
					(int) Math.round((732 * img.getResizefactor()) + ((i * 28) * img.getResizefactor())), 
					(int) Math.round(190 * img.getResizefactor()), 
					(int) Math.round(25 * img.getResizefactor())
			);
			players.get(i).getName2().setFont(DataMISC.ARIAL_BOLD16.deriveFont((float)(16 * img.getResizefactor())));
			players.get(i).getName2().setForeground(DataMISC.BROWN_FONTS);

			players.get(i).getStackint().setBounds(
					(players.get(i).getName2().getX() + (int) Math.round(250 * img.getResizefactor())), 
					(int) Math.round((732 * img.getResizefactor()) + ((i * 28) * img.getResizefactor())), 
					(int) Math.round(50 * img.getResizefactor()),  
					(int) Math.round(25 * img.getResizefactor())
			);
			players.get(i).getStackint().setHorizontalAlignment(SwingConstants.CENTER);
			players.get(i).getStackint().setFont(DataMISC.ARIAL_BOLD16.deriveFont((float)(16 * img.getResizefactor())));
			players.get(i).getStackint().setForeground(DataMISC.BROWN_FONTS);
			
			players.get(i).getBet().setBounds(
					(players.get(i).getStackint().getX() + (int) Math.round(83 * img.getResizefactor())), 
					(int) Math.round((732 * img.getResizefactor()) + ((i * 28) * img.getResizefactor())), 
					(int) Math.round(80 * img.getResizefactor()),  
					(int) Math.round(25 * img.getResizefactor())
			);
			players.get(i).getBet().setHorizontalAlignment(SwingConstants.CENTER);
			players.get(i).getBet().setFont(DataMISC.ARIAL_BOLD16.deriveFont((float)(16 * img.getResizefactor())));
			players.get(i).getBet().setForeground(DataMISC.BROWN_FONTS);
			
			players.get(i).getValue().setBounds(
					(players.get(i).getHead().getX() - (int) Math.round(40 * img.getResizefactor())), 
					(players.get(i).getHead().getY() + players.get(i).getHead().getHeight() + (int) Math.round(104 * img.getResizefactor())), 
					(int) Math.round(60 * img.getResizefactor()), 
					(int) Math.round(20 * img.getResizefactor())
			);
			players.get(i).getValue().setHorizontalAlignment(SwingConstants.CENTER);
			players.get(i).getValue().setFont(DataMISC.ARIAL_BOLD16.deriveFont((float)(16 * img.getResizefactor())));
			players.get(i).getValue().setBackground(DataMISC.GREEN_PLON);
			players.get(i).getValue().setForeground(Color.WHITE);
			
			players.get(i).getSplitvalue().setBounds(
					(players.get(i).getHead().getX() + (int) Math.round(100 * img.getResizefactor())), 
					(players.get(i).getHead().getY() + players.get(i).getHead().getHeight() + (int) Math.round(104 * img.getResizefactor())), 
					(int) Math.round(60 * img.getResizefactor()), 
					(int) Math.round(20 * img.getResizefactor())
			);
			players.get(i).getSplitvalue().setHorizontalAlignment(SwingConstants.CENTER);
			players.get(i).getSplitvalue().setFont(DataMISC.ARIAL_BOLD16.deriveFont((float)(16 * img.getResizefactor())));
			players.get(i).getSplitvalue().setBackground(DataMISC.GREEN_PLON);
			players.get(i).getSplitvalue().setForeground(Color.WHITE);
			
			players.get(i).getDealerwins().setIcon(img.getDealerwins());
			players.get(i).getDealerwins().setBounds(
					(players.get(i).getValue().getX() - (int) Math.round(30 * img.getResizefactor())), 
					(players.get(i).getValue().getY() - (int) Math.round(90 * img.getResizefactor())), 
					img.getDealerwins().getIconWidth(), 
					img.getDealerwins().getIconHeight()
			);
			players.get(i).getDealerwins().setOpaque(false);
			
			players.get(i).getYouwin().setIcon(img.getYouwin());
			players.get(i).getYouwin().setBounds(
					(players.get(i).getValue().getX() - (int) Math.round(30 * img.getResizefactor())), 
					(players.get(i).getValue().getY() - (int) Math.round(90 * img.getResizefactor())), 
					img.getYouwin().getIconWidth(), 
					img.getYouwin().getIconHeight()
			);
			players.get(i).getYouwin().setOpaque(false);
			
			players.get(i).getDraw().setIcon(img.getDraw());
			players.get(i).getDraw().setBounds(
					(players.get(i).getValue().getX() - (int) Math.round(30 * img.getResizefactor())), 
					(players.get(i).getValue().getY() - (int) Math.round(90 * img.getResizefactor())), 
					img.getDraw().getIconWidth(), 
					img.getDraw().getIconHeight()
			);
			players.get(i).getDraw().setOpaque(false);
			
			players.get(i).getSplit_dealerwins().setIcon(img.getDealerwins());
			players.get(i).getSplit_dealerwins().setBounds(
					(players.get(i).getSplitvalue().getX() - (int) Math.round(30 * img.getResizefactor())), 
					(players.get(i).getSplitvalue().getY() - (int) Math.round(90 * img.getResizefactor())), 
					img.getDealerwins().getIconWidth(), 
					img.getDealerwins().getIconHeight()
			);
			players.get(i).getSplit_dealerwins().setOpaque(false);
			
			players.get(i).getSplit_youwin().setIcon(img.getYouwin());
			players.get(i).getSplit_youwin().setBounds(
					(players.get(i).getSplitvalue().getX() - (int) Math.round(30 * img.getResizefactor())), 
					(players.get(i).getSplitvalue().getY() - (int) Math.round(90 * img.getResizefactor())), 
					img.getYouwin().getIconWidth(), 
					img.getYouwin().getIconHeight()
			);
			players.get(i).getSplit_youwin().setOpaque(false);
			
			players.get(i).getSplit_draw().setIcon(img.getDraw());
			players.get(i).getSplit_draw().setBounds(
					(players.get(i).getSplitvalue().getX() - (int) Math.round(30 * img.getResizefactor())), 
					(players.get(i).getSplitvalue().getY() - (int) Math.round(90 * img.getResizefactor())), 
					img.getDraw().getIconWidth(), 
					img.getDraw().getIconHeight()
			);
			players.get(i).getSplit_draw().setOpaque(false);
			
			players.get(i).getOutofstack().setIcon(img.getOutofstack());
			players.get(i).getOutofstack().setBounds(
					(players.get(i).getHead().getX() - (int) Math.round(11 * img.getResizefactor())), 
					(players.get(i).getHead().getY() + (int) Math.round(70 * img.getResizefactor())), 
					img.getOutofstack().getIconWidth(), 
					img.getOutofstack().getIconHeight()
			);
			players.get(i).getOutofstack().setOpaque(false);
			
			content.add(players.get(i).getName());
			content.add(players.get(i).getName2());
			content.add(players.get(i).getStackint());
			content.add(players.get(i).getBet());
			content.add(players.get(i).getValue());
			content.add(players.get(i).getSplitvalue());
			content.add(players.get(i).getDealerwins());
			content.add(players.get(i).getYouwin());
			content.add(players.get(i).getDraw());
			content.add(players.get(i).getSplit_dealerwins());
			content.add(players.get(i).getSplit_youwin());
			content.add(players.get(i).getSplit_draw());
			content.add(players.get(i).getHead());
			content.add(players.get(i).getOutofstack());
			
			players.get(i).getName().setVisible(false);
			players.get(i).getName2().setVisible(false);
			players.get(i).getStackint().setVisible(false);
			players.get(i).getBet().setVisible(false);
			players.get(i).getValue().setVisible(false);
			players.get(i).getSplitvalue().setVisible(false);
			players.get(i).getDealerwins().setVisible(false);
			players.get(i).getYouwin().setVisible(false);
			players.get(i).getDraw().setVisible(false);
			players.get(i).getSplit_dealerwins().setVisible(false);
			players.get(i).getSplit_youwin().setVisible(false);
			players.get(i).getSplit_draw().setVisible(false);
			players.get(i).getHead().setVisible(false);
			players.get(i).getOutofstack().setVisible(false);
		}
		
		//Ships
		ship_dealer1 = new JLabel(img.getShipd1());
		ship_dealer2 = new JLabel(img.getShipd2());
		ship_dealer3 = new JLabel(img.getShipd3());
		ship_dealer4 = new JLabel(img.getShipd4());
		ship_dealer5 = new JLabel(img.getShipd5());
		ship_dealer6 = new JLabel(img.getShipd6());
		ship_dealer7 = new JLabel(img.getShipd7());
		ship_dealer8 = new JLabel(img.getShipd8());
		ship_dealer9 = new JLabel(img.getShipd9());
		
		ships_dealer.add(ship_dealer1);
		ships_dealer.add(ship_dealer2);
		ships_dealer.add(ship_dealer3);
		ships_dealer.add(ship_dealer4);
		ships_dealer.add(ship_dealer5);
		ships_dealer.add(ship_dealer6);
		ships_dealer.add(ship_dealer7);
		ships_dealer.add(ship_dealer8);
		ships_dealer.add(ship_dealer9);
		
		for (int i = 0; i< ships_dealer.size(); i++) {
			ships_dealer.get(i).setBounds(-520, 245, 706, 198);
			ships_dealer.get(i).setVerticalAlignment(SwingConstants.CENTER);
			ships_dealer.get(i).setOpaque(false);
			content.add(ships_dealer.get(i));
			ships_dealer.get(i).setVisible(false);
		}
		
		ship_p1_1 = new JLabel(img.getShipp1_1());
		ship_p1_2 = new JLabel(img.getShipp1_2());
		ship_p1_3 = new JLabel(img.getShipp1_3());
		ship_p1_4 = new JLabel(img.getShipp1_4());
		ship_p1_5 = new JLabel(img.getShipp1_5());
		ship_p1_6 = new JLabel(img.getShipp1_6());
		ship_p1_7 = new JLabel(img.getShipp1_7());
		ship_p1_8 = new JLabel(img.getShipp1_8());
		ship_p1_9 = new JLabel(img.getShipp1_9());
		
		ships_p1.add(ship_p1_1);
		ships_p1.add(ship_p1_2);
		ships_p1.add(ship_p1_3);
		ships_p1.add(ship_p1_4);
		ships_p1.add(ship_p1_5);
		ships_p1.add(ship_p1_6);
		ships_p1.add(ship_p1_7);
		ships_p1.add(ship_p1_8);
		ships_p1.add(ship_p1_9);
		
		for (int i = 0; i< ships_p1.size(); i++) {
			ships_p1.get(i).setBounds(-500, 252, 706, 198);
			ships_p1.get(i).setVerticalAlignment(SwingConstants.CENTER);
			ships_p1.get(i).setOpaque(false);
			content.add(ships_p1.get(i));
			ships_p1.get(i).setVisible(false);
		}
		
		ship_p2_1 = new JLabel(img.getShipp2_1());
		ship_p2_2 = new JLabel(img.getShipp2_2());
		ship_p2_3 = new JLabel(img.getShipp2_3());
		ship_p2_4 = new JLabel(img.getShipp2_4());
		ship_p2_5 = new JLabel(img.getShipp2_5());
		ship_p2_6 = new JLabel(img.getShipp2_6());
		ship_p2_7 = new JLabel(img.getShipp2_7());
		ship_p2_8 = new JLabel(img.getShipp2_8());
		ship_p2_9 = new JLabel(img.getShipp2_9());
		
		ships_p2.add(ship_p2_1);
		ships_p2.add(ship_p2_2);
		ships_p2.add(ship_p2_3);
		ships_p2.add(ship_p2_4);
		ships_p2.add(ship_p2_5);
		ships_p2.add(ship_p2_6);
		ships_p2.add(ship_p2_7);
		ships_p2.add(ship_p2_8);
		ships_p2.add(ship_p2_9);
		
		for (int i = 0; i< ships_p2.size(); i++) {
			ships_p2.get(i).setBounds(-500, 252, 706, 198);
			ships_p2.get(i).setVerticalAlignment(SwingConstants.CENTER);
			ships_p2.get(i).setOpaque(false);
			content.add(ships_p2.get(i));
			ships_p2.get(i).setVisible(false);
		}
		
		ship_p3_1 = new JLabel(img.getShipp3_1());
		ship_p3_2 = new JLabel(img.getShipp3_2());
		ship_p3_3 = new JLabel(img.getShipp3_3());
		ship_p3_4 = new JLabel(img.getShipp3_4());
		ship_p3_5 = new JLabel(img.getShipp3_5());
		ship_p3_6 = new JLabel(img.getShipp3_6());
		ship_p3_7 = new JLabel(img.getShipp3_7());
		ship_p3_8 = new JLabel(img.getShipp3_8());
		ship_p3_9 = new JLabel(img.getShipp3_9());
		
		ships_p3.add(ship_p3_1);
		ships_p3.add(ship_p3_2);
		ships_p3.add(ship_p3_3);
		ships_p3.add(ship_p3_4);
		ships_p3.add(ship_p3_5);
		ships_p3.add(ship_p3_6);
		ships_p3.add(ship_p3_7);
		ships_p3.add(ship_p3_8);
		ships_p3.add(ship_p3_9);
		
		for (int i = 0; i< ships_p3.size(); i++) {
			ships_p3.get(i).setBounds(-500, 252, 706, 198);
			ships_p3.get(i).setVerticalAlignment(SwingConstants.CENTER);
			ships_p3.get(i).setOpaque(false);
			content.add(ships_p3.get(i));
			ships_p3.get(i).setVisible(false);
		}
		
		ship_p4_1 = new JLabel(img.getShipp4_1());
		ship_p4_2 = new JLabel(img.getShipp4_2());
		ship_p4_3 = new JLabel(img.getShipp4_3());
		ship_p4_4 = new JLabel(img.getShipp4_4());
		ship_p4_5 = new JLabel(img.getShipp4_5());
		ship_p4_6 = new JLabel(img.getShipp4_6());
		ship_p4_7 = new JLabel(img.getShipp4_7());
		ship_p4_8 = new JLabel(img.getShipp4_8());
		ship_p4_9 = new JLabel(img.getShipp4_9());
		
		ships_p4.add(ship_p4_1);
		ships_p4.add(ship_p4_2);
		ships_p4.add(ship_p4_3);
		ships_p4.add(ship_p4_4);
		ships_p4.add(ship_p4_5);
		ships_p4.add(ship_p4_6);
		ships_p4.add(ship_p4_7);
		ships_p4.add(ship_p4_8);
		ships_p4.add(ship_p4_9);
		
		for (int i = 0; i< ships_p4.size(); i++) {
			ships_p4.get(i).setBounds(-500, 252, 706, 198);
			ships_p4.get(i).setVerticalAlignment(SwingConstants.CENTER);
			ships_p4.get(i).setOpaque(false);
			content.add(ships_p4.get(i));
			ships_p4.get(i).setVisible(false);
		}
		
		ships_players.add(ships_p1);
		ships_players.add(ships_p2);
		ships_players.add(ships_p3);
		ships_players.add(ships_p4);
		
		//Heads
		head_1 = new JLabel(img.getHead1());
		head_2 = new JLabel(img.getHead2());
		head_3 = new JLabel(img.getHead3());
		head_4 = new JLabel(img.getHead4());
		head_5 = new JLabel(img.getHead5());
		head_6 = new JLabel(img.getHead6());
		head_7 = new JLabel(img.getHead7());
		head_8 = new JLabel(img.getHead8());
		head_9 = new JLabel(img.getHead9());
		head_10 = new JLabel(img.getHead10());
		head_11 = new JLabel(img.getHead11());
		head_12 = new JLabel(img.getHead12());
		head_13 = new JLabel(img.getHead13());
		head_14 = new JLabel(img.getHead14());
		head_15 = new JLabel(img.getHead15());
		head_16 = new JLabel(img.getHead16());
		
		heads.add(head_1);
		heads.add(head_2);
		heads.add(head_3);
		heads.add(head_4);
		heads.add(head_5);
		heads.add(head_6);
		heads.add(head_7);
		heads.add(head_8);
		heads.add(head_9);
		heads.add(head_10);
		heads.add(head_11);
		heads.add(head_12);
		heads.add(head_13);
		heads.add(head_14);
		heads.add(head_15);
		heads.add(head_16);
		
		//TODO braucht es das? Ist das nicht ganz oben schon passiert?
		//Fügt die Leinwand dem Fenster hinzu
		this.getContentPane().add(content);
		
		//Setzt das Hintergrundbild in der Hierarchie ganz nach hinten
		content.moveToBack(background);
	}
	
	//Methode für die erneute Positionierung der Elemente (falls sklaiert wurde) 
	public void setLocations() {
		this.setBounds(470, 80, (int) Math.round(1146 * img.getResizefactor()), (int) Math.round((860 * img.getResizefactor() + 25)));
		background.setBounds(0, 0, this.getWidth(), this.getHeight()-25);
		time.setBounds(
				(int) Math.round(this.getWidth() - (100 * img.getResizefactor())), 
				(int) Math.round(15 * img.getResizefactor()), 
				(int) Math.round(80 * img.getResizefactor()), 
				(int) Math.round(30 * img.getResizefactor())
		);
		time.setHorizontalAlignment(SwingConstants.CENTER);
		time.setFont(DataMISC.ARIAL_BOLD20.deriveFont((float)(20 * img.getResizefactor())));
		
		dealername.setBounds(
				(int) Math.round((this.getWidth() / 2) - (50 * img.getResizefactor())), 
				(int) Math.round(10 * img.getResizefactor()), 
				(int) Math.round(100 * img.getResizefactor()), 
				(int) Math.round(30 * img.getResizefactor())
		);
		dealername.setHorizontalAlignment(SwingConstants.CENTER);
		dealername.setFont(DataMISC.ARIAL_BOLD20.deriveFont((float)(20 * img.getResizefactor())));
		
		dealervalue.setBounds(
				(dealername.getX() - (int) Math.round(52 * img.getResizefactor())), 
				(dealername.getY() + (int) Math.round(275 * img.getResizefactor())), 
				(int) Math.round(60 * img.getResizefactor()), 
				(int) Math.round(20 * img.getResizefactor())
		);
		dealervalue.setHorizontalAlignment(SwingConstants.CENTER);
		dealervalue.setFont(DataMISC.ARIAL_BOLD16.deriveFont((float)(16 * img.getResizefactor())));
		
		card_b.setBounds((int) Math.round(dealername.getX() + dealername.getWidth() + (50 * img.getResizefactor())), 
				(int) Math.round(65 * img.getResizefactor()), 
				img.getCback().getIconWidth(),
				img.getCback().getIconHeight()
		);
       	card_b1.setBounds((card_b.getX() - 2), (card_b.getY() - 2), img.getCback().getIconWidth(),img.getCback().getIconHeight());
       	card_b2.setBounds((card_b1.getX() - 2), (card_b1.getY() - 2), img.getCback().getIconWidth(),img.getCback().getIconHeight());
       	card_b3.setBounds((card_b2.getX() - 2), (card_b2.getY() - 2), img.getCback().getIconWidth(),img.getCback().getIconHeight());
		card_b4.setBounds((card_b3.getX() - 2), (card_b3.getY() - 2), img.getCback().getIconWidth(),img.getCback().getIconHeight());
		
		button_newcard.setBounds(
				(int) Math.round(86 * img.getResizefactor()),(int) Math.round(715 * img.getResizefactor()), 
				img.getBtnewcard().getIconWidth(),img.getBtnewcard().getIconHeight()
		);
		button_stand.setBounds((int) Math.round(86 * img.getResizefactor()),(int) Math.round(785 * img.getResizefactor()),
				img.getBtstand().getIconWidth(),img.getBtstand().getIconHeight()
		);
		button_double.setBounds((int) Math.round(226 * img.getResizefactor()),(int) Math.round(715 * img.getResizefactor()),
				img.getBtdouble().getIconWidth(),img.getBtdouble().getIconHeight()
		);
		button_split.setBounds((int) Math.round(226 * img.getResizefactor()),(int) Math.round(785 * img.getResizefactor()),
				img.getBtsplit().getIconWidth(),img.getBtsplit().getIconHeight()
		);
		button_bet.setBounds((int) Math.round(366 * img.getResizefactor()),(int) Math.round(715 * img.getResizefactor()),
				img.getBtbet().getIconWidth(),img.getBtbet().getIconHeight()
		);
		button_deal.setBounds((int) Math.round(366 * img.getResizefactor()),(int) Math.round(785 * img.getResizefactor()),
				img.getBtdeal().getIconWidth(),img.getBtdeal().getIconHeight()
		);
		button_help.setBounds((int) Math.round(15 * img.getResizefactor()), (int) Math.round(15 * img.getResizefactor()), 
				img.getBthelp().getIconWidth(),img.getBthelp().getIconHeight()
		);
		button_options.setBounds((int) Math.round(15 * img.getResizefactor()), (int) Math.round(15 * img.getResizefactor()), 
				img.getBtoptions().getIconWidth(),img.getBtoptions().getIconHeight()
		);
		
		for (int i = 0; i < 4; i++) {
			switch (i){
			case 0: x = (int) Math.round(this.getWidth() * 0.1); y = (int) Math.round(this.getHeight() * 0.074);
					break;
			case 1: x = (int) Math.round(this.getWidth() * 0.785); y = (int) Math.round(this.getHeight() * 0.074);
					break;
			case 2: x = (int) Math.round(this.getWidth() * 0.1); y = (int) Math.round(this.getHeight() * 0.42);
					break;
			case 3: x = (int) Math.round(this.getWidth() * 0.785); y = (int) Math.round(this.getHeight() * 0.42);
					break;
			default: x = 0; y = 0;
		}
			players.get(i).getName().setBounds(x, y, (int) Math.round(110 * img.getResizefactor()), (int) Math.round(30 * img.getResizefactor()));
			players.get(i).getName().setHorizontalAlignment(SwingConstants.CENTER);
			players.get(i).getName().setFont(DataMISC.ARIAL_BOLD20.deriveFont((float)(20 * img.getResizefactor())));
			
			players.get(i).getHead().setBounds(
					(x - (int) Math.round(12 * img.getResizefactor())), 
					(y + (int) Math.round(30 * img.getResizefactor())), 
					(int) Math.round(131 * img.getResizefactor()), 
					(int) Math.round(141 * img.getResizefactor())
			);
			players.get(i).getName2().setBounds(
					(int) Math.round((this.getWidth() / 2) + (80 * img.getResizefactor())), 
					(int) Math.round((732 * img.getResizefactor()) + ((i * 28) * img.getResizefactor())), 
					(int) Math.round(190 * img.getResizefactor()), 
					(int) Math.round(25 * img.getResizefactor())
			);
			players.get(i).getName2().setFont(DataMISC.ARIAL_BOLD16.deriveFont((float)(16 * img.getResizefactor())));
			
			players.get(i).getStackint().setBounds(
					(players.get(i).getName2().getX() + (int) Math.round(250 * img.getResizefactor())), 
					(int) Math.round((732 * img.getResizefactor()) + ((i * 28) * img.getResizefactor())), 
					(int) Math.round(50 * img.getResizefactor()),  
					(int) Math.round(25 * img.getResizefactor())
			);
			players.get(i).getStackint().setHorizontalAlignment(SwingConstants.CENTER);
			players.get(i).getStackint().setFont(DataMISC.ARIAL_BOLD16.deriveFont((float)(16 * img.getResizefactor())));
			
			players.get(i).getBet().setBounds(
					(players.get(i).getStackint().getX() + (int) Math.round(83 * img.getResizefactor())), 
					(int) Math.round((732 * img.getResizefactor()) + ((i * 28) * img.getResizefactor())), 
					(int) Math.round(80 * img.getResizefactor()),  
					(int) Math.round(25 * img.getResizefactor())
			);
			players.get(i).getBet().setHorizontalAlignment(SwingConstants.CENTER);
			players.get(i).getBet().setFont(DataMISC.ARIAL_BOLD16.deriveFont((float)(16 * img.getResizefactor())));
			
			players.get(i).getValue().setBounds(
					(players.get(i).getHead().getX() - (int) Math.round(40 * img.getResizefactor())), 
					(players.get(i).getHead().getY() + players.get(i).getHead().getHeight() + (int) Math.round(104 * img.getResizefactor())), 
					(int) Math.round(60 * img.getResizefactor()), 
					(int) Math.round(20 * img.getResizefactor())
			);
			players.get(i).getValue().setHorizontalAlignment(SwingConstants.CENTER);
			players.get(i).getValue().setFont(DataMISC.ARIAL_BOLD16.deriveFont((float)(16 * img.getResizefactor())));
			
			players.get(i).getSplitvalue().setBounds(
					(players.get(i).getHead().getX() + (int) Math.round(100 * img.getResizefactor())), 
					(players.get(i).getHead().getY() + players.get(i).getHead().getHeight() + (int) Math.round(104 * img.getResizefactor())), 
					(int) Math.round(60 * img.getResizefactor()), 
					(int) Math.round(20 * img.getResizefactor())
			);
			players.get(i).getSplitvalue().setHorizontalAlignment(SwingConstants.CENTER);
			players.get(i).getSplitvalue().setFont(DataMISC.ARIAL_BOLD16.deriveFont((float)(16 * img.getResizefactor())));
			
			players.get(i).getDealerwins().setBounds(
					(players.get(i).getValue().getX() - (int) Math.round(30 * img.getResizefactor())), 
					(players.get(i).getValue().getY() - (int) Math.round(90 * img.getResizefactor())), 
					img.getDealerwins().getIconWidth(), 
					img.getDealerwins().getIconHeight()
			);
			players.get(i).getYouwin().setBounds(
					(players.get(i).getValue().getX() - (int) Math.round(30 * img.getResizefactor())), 
					(players.get(i).getValue().getY() - (int) Math.round(90 * img.getResizefactor())), 
					img.getYouwin().getIconWidth(), 
					img.getYouwin().getIconHeight()
			);
			
			players.get(i).getDraw().setBounds(
					(players.get(i).getValue().getX() - (int) Math.round(30 * img.getResizefactor())), 
					(players.get(i).getValue().getY() - (int) Math.round(90 * img.getResizefactor())), 
					img.getDraw().getIconWidth(), 
					img.getDraw().getIconHeight()
			);
			
			players.get(i).getSplit_dealerwins().setBounds(
					(players.get(i).getSplitvalue().getX() - (int) Math.round(30 * img.getResizefactor())), 
					(players.get(i).getSplitvalue().getY() - (int) Math.round(90 * img.getResizefactor())), 
					img.getDealerwins().getIconWidth(), 
					img.getDealerwins().getIconHeight()
			);
			
			players.get(i).getSplit_youwin().setBounds(
					(players.get(i).getSplitvalue().getX() - (int) Math.round(30 * img.getResizefactor())), 
					(players.get(i).getSplitvalue().getY() - (int) Math.round(90 * img.getResizefactor())), 
					img.getYouwin().getIconWidth(), 
					img.getYouwin().getIconHeight()
			);
			
			players.get(i).getSplit_draw().setBounds(
					(players.get(i).getSplitvalue().getX() - (int) Math.round(30 * img.getResizefactor())), 
					(players.get(i).getSplitvalue().getY() - (int) Math.round(90 * img.getResizefactor())), 
					img.getDraw().getIconWidth(), 
					img.getDraw().getIconHeight()
			);
			
			players.get(i).getOutofstack().setBounds(
					(players.get(i).getHead().getX() - (int) Math.round(11 * img.getResizefactor())), 
					(players.get(i).getHead().getY() + (int) Math.round(70 * img.getResizefactor())), 
					img.getOutofstack().getIconWidth(), 
					img.getOutofstack().getIconHeight()
			);
		}
		
		for (int i = 0; i< ships_dealer.size(); i++) {
			ships_dealer.get(i).setBounds(-520, 245, 706, 198);
			ships_dealer.get(i).setVerticalAlignment(SwingConstants.CENTER);
		}
		for (int i = 0; i< ships_p1.size(); i++) {
			ships_p1.get(i).setBounds(-500, 252, 706, 198);
			ships_p1.get(i).setVerticalAlignment(SwingConstants.CENTER);
		}
		for (int i = 0; i< ships_p2.size(); i++) {
			ships_p2.get(i).setBounds(-500, 252, 706, 198);
			ships_p2.get(i).setVerticalAlignment(SwingConstants.CENTER);
		}
		for (int i = 0; i< ships_p3.size(); i++) {
			ships_p3.get(i).setBounds(-500, 252, 706, 198);
			ships_p3.get(i).setVerticalAlignment(SwingConstants.CENTER);
		}
		for (int i = 0; i< ships_p4.size(); i++) {
			ships_p4.get(i).setBounds(-500, 252, 706, 198);
			ships_p4.get(i).setVerticalAlignment(SwingConstants.CENTER);
		}
	}
	
	//Setzt die Elemente der Spieler in Abhängigkeit zum Head neu
	//(wird aufgerufen, wenn bei 1 oder 2 Spielern nur der untere Teil des Tisches genutzt wird
	public void updateLoc() {
		for (int i = 0; i < 4; i++) {
			players.get(i).getValue().setBounds(
					(players.get(i).getHead().getX() - (int) Math.round(40 * img.getResizefactor())), 
					(players.get(i).getHead().getY() + players.get(i).getHead().getHeight() + (int) Math.round(104 * img.getResizefactor())), 
					(int) Math.round(60 * img.getResizefactor()), 
					(int) Math.round(20 * img.getResizefactor())
			);
			players.get(i).getSplitvalue().setBounds(
					(players.get(i).getHead().getX() + (int) Math.round(100 * img.getResizefactor())), 
					(players.get(i).getHead().getY() + players.get(i).getHead().getHeight() + (int) Math.round(104 * img.getResizefactor())), 
					(int) Math.round(60 * img.getResizefactor()), 
					(int) Math.round(20 * img.getResizefactor())
			);
			players.get(i).getDealerwins().setBounds(
					(players.get(i).getValue().getX() - (int) Math.round(30 * img.getResizefactor())), 
					(players.get(i).getValue().getY() - (int) Math.round(90 * img.getResizefactor())), 
					img.getDealerwins().getIconWidth(), 
					img.getDealerwins().getIconHeight()
			);
			players.get(i).getYouwin().setBounds(
					(players.get(i).getValue().getX() - (int) Math.round(30 * img.getResizefactor())), 
					(players.get(i).getValue().getY() - (int) Math.round(90 * img.getResizefactor())), 
					img.getYouwin().getIconWidth(), 
					img.getYouwin().getIconHeight()
			);
			players.get(i).getDraw().setBounds(
					(players.get(i).getValue().getX() - (int) Math.round(30 * img.getResizefactor())), 
					(players.get(i).getValue().getY() - (int) Math.round(90 * img.getResizefactor())), 
					img.getDraw().getIconWidth(), 
					img.getDraw().getIconHeight()
			);
			players.get(i).getSplit_dealerwins().setBounds(
					(players.get(i).getSplitvalue().getX() - (int) Math.round(30 * img.getResizefactor())), 
					(players.get(i).getSplitvalue().getY() - (int) Math.round(90 * img.getResizefactor())), 
					img.getDealerwins().getIconWidth(), 
					img.getDealerwins().getIconHeight()
			);
			players.get(i).getSplit_youwin().setBounds(
					(players.get(i).getSplitvalue().getX() - (int) Math.round(30 * img.getResizefactor())), 
					(players.get(i).getSplitvalue().getY() - (int) Math.round(90 * img.getResizefactor())), 
					img.getYouwin().getIconWidth(), 
					img.getYouwin().getIconHeight()
			);
			players.get(i).getSplit_draw().setBounds(
					(players.get(i).getSplitvalue().getX() - (int) Math.round(30 * img.getResizefactor())), 
					(players.get(i).getSplitvalue().getY() - (int) Math.round(90 * img.getResizefactor())), 
					img.getDraw().getIconWidth(), 
					img.getDraw().getIconHeight()
			);
			players.get(i).getOutofstack().setBounds(
					(players.get(i).getHead().getX() - (int) Math.round(11 * img.getResizefactor())), 
					(players.get(i).getHead().getY() + (int) Math.round(70 * img.getResizefactor())), 
					img.getOutofstack().getIconWidth(), 
					img.getOutofstack().getIconHeight()
			);
		}
	}
	
	//Definiert Listener für die Buttons
	public void setMainListener(ActionListener ae) {
		this.button_newcard.addActionListener(ae);
		this.button_stand.addActionListener(ae);
		this.button_double.addActionListener(ae);
		this.button_split.addActionListener(ae);
		this.button_bet.addActionListener(ae);
		this.button_deal.addActionListener(ae);
		this.button_help.addActionListener(ae);
		this.button_options.addActionListener(ae);
	}
	
	public JLayeredPane getContent() {
		return content;
	}

	public JLabel getTime() {
		return time;
	}

	public void setTime(JLabel time) {
		this.time = time;
	}

	public void setContent(JLayeredPane content) {
		this.content = content;
	}

	public List<PlayerView> getPlayers() {
		return players;
	}

	public void setPlayers(List<PlayerView> players) {
		this.players = players;
	}
	
	public JLabel getDealername() {
		return dealername;
	}

	public void setDealername(JLabel dealername) {
		this.dealername = dealername;
	}

	public JLabel getDealervalue() {
		return dealervalue;
	}

	public void setDealervalue(JLabel dealervalue) {
		this.dealervalue = dealervalue;
	}

	public List<JLabel> getCardsimg() {
		return cardsimg;
	}

	public void setCardsimg(List<JLabel> cardsimg) {
		this.cardsimg = cardsimg;
	}

	public JLabel getCard_b() {
		return card_b;
	}

	public void setCard_b(JLabel card_b) {
		this.card_b = card_b;
	}

	public JLabel getShip_dealer1() {
		return ship_dealer1;
	}

	public void setShip_dealer1(JLabel ship_dealer1) {
		this.ship_dealer1 = ship_dealer1;
	}

	public JLabel getShip_dealer2() {
		return ship_dealer2;
	}

	public void setShip_dealer2(JLabel ship_dealer2) {
		this.ship_dealer2 = ship_dealer2;
	}

	public JLabel getShip_dealer3() {
		return ship_dealer3;
	}

	public void setShip_dealer3(JLabel ship_dealer3) {
		this.ship_dealer3 = ship_dealer3;
	}

	public JLabel getShip_dealer4() {
		return ship_dealer4;
	}

	public void setShip_dealer4(JLabel ship_dealer4) {
		this.ship_dealer4 = ship_dealer4;
	}

	public JLabel getShip_dealer5() {
		return ship_dealer5;
	}

	public void setShip_dealer5(JLabel ship_dealer5) {
		this.ship_dealer5 = ship_dealer5;
	}

	public JLabel getShip_dealer6() {
		return ship_dealer6;
	}

	public void setShip_dealer6(JLabel ship_dealer6) {
		this.ship_dealer6 = ship_dealer6;
	}

	public JLabel getShip_dealer7() {
		return ship_dealer7;
	}

	public void setShip_dealer7(JLabel ship_dealer7) {
		this.ship_dealer7 = ship_dealer7;
	}

	public JLabel getShip_dealer8() {
		return ship_dealer8;
	}

	public void setShip_dealer8(JLabel ship_dealer8) {
		this.ship_dealer8 = ship_dealer8;
	}

	public JLabel getShip_dealer9() {
		return ship_dealer9;
	}

	public void setShip_dealer9(JLabel ship_dealer9) {
		this.ship_dealer9 = ship_dealer9;
	}

	public List<JLabel> getShips_dealer() {
		return ships_dealer;
	}

	public void setShips_dealer(List<JLabel> ships_dealer) {
		this.ships_dealer = ships_dealer;
	}

	public JLabel getShip_p1_1() {
		return ship_p1_1;
	}

	public void setShip_p1_1(JLabel ship_p1_1) {
		this.ship_p1_1 = ship_p1_1;
	}

	public JLabel getShip_p1_2() {
		return ship_p1_2;
	}

	public void setShip_p1_2(JLabel ship_p1_2) {
		this.ship_p1_2 = ship_p1_2;
	}

	public JLabel getShip_p1_3() {
		return ship_p1_3;
	}

	public void setShip_p1_3(JLabel ship_p1_3) {
		this.ship_p1_3 = ship_p1_3;
	}

	public JLabel getShip_p1_4() {
		return ship_p1_4;
	}

	public void setShip_p1_4(JLabel ship_p1_4) {
		this.ship_p1_4 = ship_p1_4;
	}

	public JLabel getShip_p1_5() {
		return ship_p1_5;
	}

	public void setShip_p1_5(JLabel ship_p1_5) {
		this.ship_p1_5 = ship_p1_5;
	}

	public JLabel getShip_p1_6() {
		return ship_p1_6;
	}

	public void setShip_p1_6(JLabel ship_p1_6) {
		this.ship_p1_6 = ship_p1_6;
	}

	public JLabel getShip_p1_7() {
		return ship_p1_7;
	}

	public void setShip_p1_7(JLabel ship_p1_7) {
		this.ship_p1_7 = ship_p1_7;
	}

	public JLabel getShip_p1_8() {
		return ship_p1_8;
	}

	public void setShip_p1_8(JLabel ship_p1_8) {
		this.ship_p1_8 = ship_p1_8;
	}

	public JLabel getShip_p1_9() {
		return ship_p1_9;
	}

	public void setShip_p1_9(JLabel ship_p1_9) {
		this.ship_p1_9 = ship_p1_9;
	}

	public List<JLabel> getShips_p1() {
		return ships_p1;
	}

	public void setShips_p1(List<JLabel> ships_p1) {
		this.ships_p1 = ships_p1;
	}

	public JLabel getShip_p2_1() {
		return ship_p2_1;
	}

	public void setShip_p2_1(JLabel ship_p2_1) {
		this.ship_p2_1 = ship_p2_1;
	}

	public JLabel getShip_p2_2() {
		return ship_p2_2;
	}

	public void setShip_p2_2(JLabel ship_p2_2) {
		this.ship_p2_2 = ship_p2_2;
	}

	public JLabel getShip_p2_3() {
		return ship_p2_3;
	}

	public void setShip_p2_3(JLabel ship_p2_3) {
		this.ship_p2_3 = ship_p2_3;
	}

	public JLabel getShip_p2_4() {
		return ship_p2_4;
	}

	public void setShip_p2_4(JLabel ship_p2_4) {
		this.ship_p2_4 = ship_p2_4;
	}

	public JLabel getShip_p2_5() {
		return ship_p2_5;
	}

	public void setShip_p2_5(JLabel ship_p2_5) {
		this.ship_p2_5 = ship_p2_5;
	}

	public JLabel getShip_p2_6() {
		return ship_p2_6;
	}

	public void setShip_p2_6(JLabel ship_p2_6) {
		this.ship_p2_6 = ship_p2_6;
	}

	public JLabel getShip_p2_7() {
		return ship_p2_7;
	}

	public void setShip_p2_7(JLabel ship_p2_7) {
		this.ship_p2_7 = ship_p2_7;
	}

	public JLabel getShip_p2_8() {
		return ship_p2_8;
	}

	public void setShip_p2_8(JLabel ship_p2_8) {
		this.ship_p2_8 = ship_p2_8;
	}

	public JLabel getShip_p2_9() {
		return ship_p2_9;
	}

	public void setShip_p2_9(JLabel ship_p2_9) {
		this.ship_p2_9 = ship_p2_9;
	}

	public List<JLabel> getShips_p2() {
		return ships_p2;
	}

	public void setShips_p2(List<JLabel> ships_p2) {
		this.ships_p2 = ships_p2;
	}

	public JLabel getShip_p3_1() {
		return ship_p3_1;
	}

	public void setShip_p3_1(JLabel ship_p3_1) {
		this.ship_p3_1 = ship_p3_1;
	}

	public JLabel getShip_p3_2() {
		return ship_p3_2;
	}

	public void setShip_p3_2(JLabel ship_p3_2) {
		this.ship_p3_2 = ship_p3_2;
	}

	public JLabel getShip_p3_3() {
		return ship_p3_3;
	}

	public void setShip_p3_3(JLabel ship_p3_3) {
		this.ship_p3_3 = ship_p3_3;
	}

	public JLabel getShip_p3_4() {
		return ship_p3_4;
	}

	public void setShip_p3_4(JLabel ship_p3_4) {
		this.ship_p3_4 = ship_p3_4;
	}

	public JLabel getShip_p3_5() {
		return ship_p3_5;
	}

	public void setShip_p3_5(JLabel ship_p3_5) {
		this.ship_p3_5 = ship_p3_5;
	}

	public JLabel getShip_p3_6() {
		return ship_p3_6;
	}

	public void setShip_p3_6(JLabel ship_p3_6) {
		this.ship_p3_6 = ship_p3_6;
	}

	public JLabel getShip_p3_7() {
		return ship_p3_7;
	}

	public void setShip_p3_7(JLabel ship_p3_7) {
		this.ship_p3_7 = ship_p3_7;
	}

	public JLabel getShip_p3_8() {
		return ship_p3_8;
	}

	public void setShip_p3_8(JLabel ship_p3_8) {
		this.ship_p3_8 = ship_p3_8;
	}

	public JLabel getShip_p3_9() {
		return ship_p3_9;
	}

	public void setShip_p3_9(JLabel ship_p3_9) {
		this.ship_p3_9 = ship_p3_9;
	}

	public List<JLabel> getShips_p3() {
		return ships_p3;
	}

	public void setShips_p3(List<JLabel> ships_p3) {
		this.ships_p3 = ships_p3;
	}

	public JLabel getShip_p4_1() {
		return ship_p4_1;
	}

	public void setShip_p4_1(JLabel ship_p4_1) {
		this.ship_p4_1 = ship_p4_1;
	}

	public JLabel getShip_p4_2() {
		return ship_p4_2;
	}

	public void setShip_p4_2(JLabel ship_p4_2) {
		this.ship_p4_2 = ship_p4_2;
	}

	public JLabel getShip_p4_3() {
		return ship_p4_3;
	}

	public void setShip_p4_3(JLabel ship_p4_3) {
		this.ship_p4_3 = ship_p4_3;
	}

	public JLabel getShip_p4_4() {
		return ship_p4_4;
	}

	public void setShip_p4_4(JLabel ship_p4_4) {
		this.ship_p4_4 = ship_p4_4;
	}

	public JLabel getShip_p4_5() {
		return ship_p4_5;
	}

	public void setShip_p4_5(JLabel ship_p4_5) {
		this.ship_p4_5 = ship_p4_5;
	}

	public JLabel getShip_p4_6() {
		return ship_p4_6;
	}

	public void setShip_p4_6(JLabel ship_p4_6) {
		this.ship_p4_6 = ship_p4_6;
	}

	public JLabel getShip_p4_7() {
		return ship_p4_7;
	}

	public void setShip_p4_7(JLabel ship_p4_7) {
		this.ship_p4_7 = ship_p4_7;
	}

	public JLabel getShip_p4_8() {
		return ship_p4_8;
	}

	public void setShip_p4_8(JLabel ship_p4_8) {
		this.ship_p4_8 = ship_p4_8;
	}

	public JLabel getShip_p4_9() {
		return ship_p4_9;
	}

	public void setShip_p4_9(JLabel ship_p4_9) {
		this.ship_p4_9 = ship_p4_9;
	}

	public List<JLabel> getShips_p4() {
		return ships_p4;
	}

	public void setShips_p4(List<JLabel> ships_p4) {
		this.ships_p4 = ships_p4;
	}

	public List<List<JLabel>> getShips_players() {
		return ships_players;
	}

	public void setShips_players(List<List<JLabel>> ships_players) {
		this.ships_players = ships_players;
	}

	public JLabel getHead_1() {
		return head_1;
	}

	public void setHead_1(JLabel head_1) {
		this.head_1 = head_1;
	}

	public JLabel getHead_2() {
		return head_2;
	}

	public void setHead_2(JLabel head_2) {
		this.head_2 = head_2;
	}

	public JLabel getHead_3() {
		return head_3;
	}

	public void setHead_3(JLabel head_3) {
		this.head_3 = head_3;
	}

	public JLabel getHead_4() {
		return head_4;
	}

	public void setHead_4(JLabel head_4) {
		this.head_4 = head_4;
	}

	public JLabel getHead_5() {
		return head_5;
	}

	public void setHead_5(JLabel head_5) {
		this.head_5 = head_5;
	}

	public JLabel getHead_6() {
		return head_6;
	}

	public void setHead_6(JLabel head_6) {
		this.head_6 = head_6;
	}

	public JLabel getHead_7() {
		return head_7;
	}

	public void setHead_7(JLabel head_7) {
		this.head_7 = head_7;
	}

	public JLabel getHead_8() {
		return head_8;
	}

	public void setHead_8(JLabel head_8) {
		this.head_8 = head_8;
	}

	public JLabel getHead_9() {
		return head_9;
	}

	public void setHead_9(JLabel head_9) {
		this.head_9 = head_9;
	}

	public JLabel getHead_10() {
		return head_10;
	}

	public void setHead_10(JLabel head_10) {
		this.head_10 = head_10;
	}

	public JLabel getHead_11() {
		return head_11;
	}

	public void setHead_11(JLabel head_11) {
		this.head_11 = head_11;
	}

	public JLabel getHead_12() {
		return head_12;
	}

	public void setHead_12(JLabel head_12) {
		this.head_12 = head_12;
	}

	public JLabel getHead_13() {
		return head_13;
	}

	public void setHead_13(JLabel head_13) {
		this.head_13 = head_13;
	}

	public JLabel getHead_14() {
		return head_14;
	}

	public void setHead_14(JLabel head_14) {
		this.head_14 = head_14;
	}

	public JLabel getHead_15() {
		return head_15;
	}

	public void setHead_15(JLabel head_15) {
		this.head_15 = head_15;
	}

	public JLabel getHead_16() {
		return head_16;
	}

	public void setHead_16(JLabel head_16) {
		this.head_16 = head_16;
	}

	public List<JLabel> getHeads() {
		return heads;
	}

	public void setHeads(List<JLabel> heads) {
		this.heads = heads;
	}

	public JLabel getBackgr() {
		return background;
	}

	public void setBackground(JLabel background) {
		this.background = background;
	}

	public List<JButton> getJbuttons() {
		return jbuttons;
	}

	public void setJbuttons(List<JButton> jbuttons) {
		this.jbuttons = jbuttons;
	}

	public JButton getButton_newcard() {
		return button_newcard;
	}

	public void setButton_newcard(JButton button_newcard) {
		this.button_newcard = button_newcard;
	}

	public JButton getButton_double() {
		return button_double;
	}

	public void setButton_double(JButton button_double) {
		this.button_double = button_double;
	}

	public JButton getButton_bet() {
		return button_bet;
	}

	public void setButton_bet(JButton button_bet) {
		this.button_bet = button_bet;
	}

	public JButton getButton_stand() {
		return button_stand;
	}

	public void setButton_stand(JButton button_stand) {
		this.button_stand = button_stand;
	}

	public JButton getButton_split() {
		return button_split;
	}

	public void setButton_split(JButton button_split) {
		this.button_split = button_split;
	}

	public JButton getButton_deal() {
		return button_deal;
	}

	public void setButton_deal(JButton button_deal) {
		this.button_deal = button_deal;
	}

	public JButton getButton_help() {
		return button_help;
	}

	public void setButton_help(JButton button_help) {
		this.button_help = button_help;
	}

	public JButton getButton_options() {
		return button_options;
	}

	public void setButton_options(JButton button_options) {
		this.button_options = button_options;
	}
}
